package com.pojo;

import com.util.ValidatorMessage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 卡车类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
@ApiModel(value = "汽车实体类")
public class Car {



    @ApiModelProperty(value = "汽车id")
    private Long id;

    /**
     * 制造商  name:是制定key的别名
     * 如果实体类属性是factur，当在@ApiModelProperty中设置name=制造商，
     * 那么前端传过来的key就是"制造商"
     * 所以我们@ApiModelProperty中指定valu即可
     */

    @ApiModelProperty(value = "制造商",required = true,dataType = "String")
    @NotNull(message = "制造商"+ValidatorMessage.NOT_BLANL)
    private String factur;

    /**
     * 车牌号
     */
    @ApiModelProperty(value = "车牌号",required = true,dataType = "String")
    @NotBlank(message = "车牌号"+ValidatorMessage.NOT_BLANL)
    @Size(min = 4, max = 10,message = "车牌号"+ValidatorMessage.MIN_SIZE+"4"+ValidatorMessage.MAX_SIZE+"10")
    private String licensePlate;

    /**
     * 座位数
     */
    @ApiModelProperty(value = "座位号",required = true,dataType = "Integer")
    @Min(value = 2,message = "座位号"+ValidatorMessage.MIN+2)
    @NotNull(message = "座位号"+ValidatorMessage.NOT_BLANL)
    private Integer seatCount;
}
